Skip to content

Conversation

@FGasper
Copy link
Collaborator

@FGasper FGasper commented Nov 13, 2025

PR #169 made document comparison use a memory pool. That changeset neglected to update uses of bson.Raw.Lookup(), which does not clone the field’s raw value. Thus, when a mismatched document was “put back” into memory, another thread overwrote a part of it.

Thus we got mismatch documents (i.e., in verifier metadata) where the same document ID showed up twice. This also, critically, made the verifier skip necessary rechecks because a later mismatch overwrote the buffer that contains the document ID meant for recheck.

This changeset fixes that problem by always cloning the document ID as part of reporting a mismatch. It also beefs up testing to ensure that the expected document IDs are reported in the log and in the rechecks.

This also makes the field-order-difference mismatch text more concise by removing a redundant document ID.

@FGasper FGasper requested a review from mmcclimon November 13, 2025 15:03
Copy link
Collaborator

@mmcclimon mmcclimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof yeah, subtle! LGTM, thanks.

@FGasper FGasper merged commit 59a21af into mongodb-labs:main Nov 13, 2025
99 checks passed
@FGasper FGasper deleted the REP-6826-clone-doc-id-in-mismatch branch November 13, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants